<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:wh="http://java.sun.com/jsf/composite/wh"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">
			<h:form id="form" styleClass="horizontal_full">
					<p:panel>
						<p:breadCrumb>
							<p:menuitem value="Categories" url="adminGameManagement.xhtml#" />
							<p:menuitem value="#{adminMBean.selectedGame.name}"
								url="adminGameManagement.xhtml#" />
							<p:menuitem value="Round #{adminMBean.selectedRound.roundNumber}"
								url="adminRoundManagement.xhtml#" />
							<p:menuitem value="#{adminMBean.selectedAgentType.agentName}"
								url="adminAgentTypeManagement.xhtml#" />
						</p:breadCrumb>
	
						<h1>Agent Management</h1>
						<p>
							Allows you to configure the preferences of each produced agent that was created with the agenttype settings.
						</p>
						<p:dataTable id="agentTable" var="agent"
							value="#{adminMBean.agentTypeAgents()}"
							paginatorTemplate="{RowsPerPageDropdown} {CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
							rowsPerPageTemplate="10,25,50,100" paginator="true" rows="100">
	
							<f:facet name="header">
						            Agent Overview for Round #{adminMBean.selectedRound.roundNumber} for AgentType #{adminMBean.selectedAgentType.agentName} in Game #{adminMBean.selectedGame.name}
						    </f:facet>

							<p:column headerText="Price Preference" sortBy="#{agent.preferencePrice}">
								<h:inputText id="priceInput" value="#{agent.preferencePrice}" style="width:96%" readonly="#{adminMBean.selectedRound.played}"
								converterMessage="Price preference has to be between 0 and 1."
								validatorMessage="Price preference has to be between 0 and 1.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>

							<p:column headerText="Quality Preference" sortBy="#{agent.preferenceQuality}">
								<h:inputText id="qualityInput" value="#{agent.preferenceQuality}" style="width:96%" readonly="#{adminMBean.selectedRound.played}"
								converterMessage="Quality preference has to be between 0 and 1."
								validatorMessage="Quality preference has to be between 0 and 1.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
						
							<p:column headerText="Image Preference" sortBy="#{agent.preferenceImage}">
								<h:inputText id="imageInput" value="#{agent.preferenceImage}" style="width:96%" readonly="#{adminMBean.selectedRound.played}"
								converterMessage="Image preference has to be between 0 and 1."
								validatorMessage="Image preference has to be between 0 and 1.">
									<f:validateLongRange minimum="0" maximum="1"/>
								</h:inputText>
							</p:column>
							
							<f:facet name="footer">
								<p:commandButton value="Reload" action="#{adminMBean.actionRefreshAllAgentTypeAgents()}" update="agentTable" icon="ui-icon-refresh"/>
								<p:commandButton value="Save Agent Settings"
								actionListener="#{adminMBean.actionSaveAndRefreshAllAgents}"
								update="agentTable" icon="ui-icon-disk" disabled="#{adminMBean.selectedRound.played}"/>
								
								
								
							</f:facet>
						
						</p:dataTable>
					</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>